/**
 * @file crud action
 * @author liaoxuezhi@baidu.com
 */
/* eslint fecs-indent: [0, "space", 2, 2] */

import {
  REQ_FETCH_CRUD,
  REC_FETCH_CRUD,

  REQ_QUICK_SAVE,
  REC_QUICK_SAVE,

  // 删除, 支持批量
  REQ_DELETE_DATA,
  REC_DELETE_DATA,

  // 保存顺序
  REQ_SAVE_ORDER,
  REC_SAVE_ORDER,

  // 其他 Action
  REQ_ACTION,
  REC_ACTION,

  // 其他批量操作
  REQ_BULK_ACTION,
  REC_BULK_ACTION,

  // 清空crud
  CLEAR_CRUD

} from './action-types';
import {createAjaxAction, createScopedDispatchAction} from '../renderer';

export const fetchData = createAjaxAction('get', REQ_FETCH_CRUD, REC_FETCH_CRUD);
export const quickSave = createAjaxAction('post', REQ_QUICK_SAVE, REC_QUICK_SAVE);
export const saveOrder = createAjaxAction('post', REQ_SAVE_ORDER, REC_SAVE_ORDER);
export const doAction = createAjaxAction('post', REQ_ACTION, REC_ACTION);
export const doBulkAction = createAjaxAction('post', REQ_BULK_ACTION, REC_BULK_ACTION);
export const clearCrud = createScopedDispatchAction(CLEAR_CRUD);
